/*
 * =====================================================================================
 *
 *       Filename:  common.h
 *
 *    Description:  
 *
 *        Version:  1.0
 *        Created:  01/22/2018 03:32:17 PM
 *       Revision:  none
 *       Compiler:  gcc
 *
 *         Author:  jianxi sun (jianxi), ycsunjane@gmail.com
 *   Organization:  
 *
 * =====================================================================================
 */
#ifndef __COMMON_h__
#define __COMMON_h__
#include "config.h"
#include "log.h"
/* XXX: eth 1500 - 20ip - 20tcp, pppoe 1492 - 20ip - 20tcp */
#define MSS 	(1452)
#define min(a, b) (((a) < (b)) ? (a) : (b))
#define max(a, b) (((a) > (b)) ? (a) : (b))

#define MAX_CONNECT_TIMEOUT 10

void *ss_malloc(size_t size);
void *ss_realloc(void *ptr, size_t new_size);
void str_to_hex(uint8_t *hexbuf, uint8_t *strbuf, int len);
#define ss_free(ptr)     \
    do {                 \
        free(ptr);       \
        ptr = NULL;      \
    } while(0)

#endif /* __COMMON_h__ */
